//
//  FATabBarController.m
//  HAFund
//
//  Created by 夏成龙 on 2018/10/26.
//  Copyright © 2018年 夏成龙. All rights reserved.
//

#import "HATabBarController.h"
#import "HANavitationController.h"
#import "HAHomeViewController.h"
#import "HAInvestViewController.h"
#import "HAServeViewController.h"
#import "HAMineViewController.h"

@interface HATabBarController ()

@end

@implementation HATabBarController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self configControllers];
}
    
- (void)configControllers {
    
    [self setViewController:[[HAHomeViewController alloc] init] itemImage:@"nil" selectedImage:@"nil" itemTitle:@"首页"];
    [self setViewController:[[HAInvestViewController alloc] init] itemImage:@"nil" selectedImage:@"nil" itemTitle:@"投资"];
    [self setViewController:[[HAServeViewController alloc] init] itemImage:@"nil" selectedImage:@"nil" itemTitle:@"投资"];
    [self setViewController:[[HAMineViewController alloc] init] itemImage:@"nil" selectedImage:@"nil" itemTitle:@"我的"];
}
    
- (void)setViewController:(UIViewController *)viewController itemImage:(NSString *)image selectedImage:(NSString *)selectedImage itemTitle:(NSString *)title {
    HANavitationController *navVC = [[HANavitationController alloc] initWithRootViewController:viewController];
    navVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:title image:[[UIImage imageNamed:image] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    [navVC.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName: THEME_COLOR} forState:UIControlStateSelected];
    [self addChildViewController:navVC];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
